<template>
	<view>
		<view class="topContent">
			<view class="title">
				{{$t('inspection.message.enterCode')}}：
			</view>
		</view>
		
		<view class="summaryInput">
			 <input class="uni-input" v-model="areaOrLocaNo" :placeholder="$t('baseCommon.message.pleaseEnter', { title: '' })" />
		</view>
		<view class="submitBtn">
			<button type="primary" @click="userSubmit">{{$t('baseCommon.buttons.confirm')}}</button>
		</view>
	</view>
</template>

<script>
	import { notice } from '@/utils/common.js'
	import { inspect as util } from '@/utils/business/common.js'
	
	export default {
		data() {
			return {
				taskId:'',
				lineId:'',
				isAreaLocation: 1,
				areaOrLocaNo:''
			}
		},
		onLoad(option) {
			this.taskId = option.taskId
			this.lineId = option.lineId
			this.isAreaLocation = option.isAreaLocation
		},
		methods: {
			async userSubmit(){
				let result = await util.verifyControlMode(this.taskId, this.areaOrLocaNo, 'hand', 'online')
				if(result.isPass) {
					uni.redirectTo({
						url: '/pages/business/inspect/inspectItem?taskId=' + this.taskId + '&lineId=' + this.lineId + 
							'&areaId=' + result.areaId + '&locaId=' + result.locaId + '&isAreaLocation=' + this.isAreaLocation
					});
				} else {
					notice.toast(result.msg)
				}
			}
		}
	}
</script>

<style lang="scss">
	page {
		background:  #F1F1F1;
	}
	
	.topContent{
		font-size: 14px;
		
		.title{
			padding: 32upx 30upx;
			color: #666;
		}
	}

	.summaryInput{
		font-size: 14px;
		background: white;
		margin: 0 15px;
		border-radius: 4px;
		text-align: center;
		
		.uni-input{
			height: 45px;
			line-height: 45px;
		}
	}
	
	.submitBtn{
		width: 100%;
		margin: 30px auto;
		
		button{
			background-color: #1E91E6;
		}
	}
</style>
